package config;

import dao.impl.UserDaoImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @Author: fancyears·milos·malvis
 * @Description:
 * @Date: Created in  2019/4/22 15:14
 * @Modified By:
 */
@Configuration
//@Import(BootConfig.class)//导入了另一个配置类(不是配置类也可以导入，但是好像只能导入1个)
@Import(BootOutOfConfig.class)
public class BootWithConfig {
    @Bean(initMethod = "init" ,destroyMethod = "cleanup")
//    @Scope("prototype")//非单例模式的bean不会执行destroyMethod定义的方法
    public UserDaoImpl getUserDaoFromConfig(){
        return new UserDaoImpl();
    }
}
